{extend name="public/base" /}
{block name="header"}
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/ueditor/lang/zh-cn/zh-cn.js"></script>
{/block}
{block name="main"}
<section class="scrollable padder">
    <ul class="breadcrumb no-border no-radius b-b b-light pull-in">
        <li><a><i class="fa fa-home"></i> 首页</a></li>
        <li class="active">公告管理</li>
        <li class="active">编辑公告</li>
    </ul>
    <div class="row">
        <div class="col-sm-12">
            <section class="panel panel-default">
                <header class="panel-heading font-bold">编辑公告</header>
                <div class="panel-body">
                    <form id="ajaxform" role="form" method="post" onsubmit="return false;">
                        <input name="id" style="display: none;" value="{$notice.id|default=''}">
                        <div class="panel-body">
                            <div class="form-group pull-in clearfix">
                                <div class="form-group col-md-10">
                                    <label>标题</label>
                                    <input type="text" name="title" class="form-control"  value="{$notice.title|default=''}" placeholder="请输入公告标题" >
                                </div>
                            </div>
                            <div class="form-group pull-in clearfix">
                                <div class="form-group col-md-10">
                                    <script id="editor" name="editor" type="text/plain" style="width:100%;height:270px;">
                                        {$notice.content|default=''|htmlspecialchars_decode}
                                    </script>
                                </div>
                            </div>
                        <footer class="panel-footer text-right bg-light lter col-md-10">
                            <button type="submit" class="btn btn-success btn-s-xs" onclick="ajaxSubmit()">提交</button>
                        </footer>
                    </form>
                </div>
            </section>
        </div>
    </div>
</section>
{/block}
{block name="footer"}
<script>
    function ajaxSubmit() {
        //var content=UE.getEditor('editor').getContent();不用js获取,可以直接form提交
        $.ajax({
            type : "POST",
            url:"{:url('index/noticeedit')}",
            data : $('#ajaxform').serialize(),
            success: function(data){
            Onsuccess(data);
          }
        });
    }

    $(document).ready(function () {
        UE.getEditor('editor');
    });


</script>
{/block}

